<template>
  <div class="sch" ref="child">
    <div class="content">
      <div class="title"><h4>请添加事项</h4></div>
      <div class="list">
        <span>时间：</span><input v-model="schtime" type="text" placeholder="请添加时间" name="">
        <span>地点：</span><input v-model="schplace" type="text" placeholder="请添加地点" name="">
        <span>事项：</span><input v-model="schmatter" type="text" placeholder="请添加事项" name="">
      </div>
      <div><button @click="upsch()">提交</button></div>
    </div>


  </div>
</template>
<script type="text/javascript">
  export default{
    data(){
      return {
        schtime: '',
        schplace: '',
        schmatter: '',
        addEvData: {}
      }
    },
    props : {
      onSchshow: {
        type: Function,
        default: undefined,
        require: false
      },
      schdata: {
        type: Array
      },
      schViewId: {
        type: String
      }
    },
    methods: {
      upsch(){
        // console.log(this.schdata);
        // console.log(this.onSchshow);

        this.addEvData.id = this.schViewId;
        this.addEvData.schtime = this.schtime;
        this.addEvData.schplace = this.schplace;
        this.addEvData.schmatter = this.schmatter;

        this.$emit('receivedata',this.addEvData)
        this.onSchshow()
      }
    }
  }
</script>
<style type="text/css" lang="sass" scoped>
  .sch{
    z-index: 999;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0,0,0,.5);

    .content{
      background-color: #fff;
      position: absolute;
      top: 50%;
      transform: translate(0,-50%);
      left: 24px;
      right: 24px;
      border-radius: 5px;
      padding: 10px;
    }

    .title{
      text-align: center;
      h5{
        color: #333;
      }
    }

    .content button{
      float: right;
      margin-right: 15px;
      background-color: #ff5236;
      color: #fff;
    }
  }
</style>





